home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
general
/
viewers
/
polyview
/
polyvw31.lha
/
Polyview3.1
/
new
/
pvevent.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-23
|
5KB
|
129 lines
/*****************************************************************************
* NCSA Polyview 3.0 *
* *
* Version 3 changes and additions by Marc Andreessen. *
* Version 2 by Brian Calvert. *
* *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* *
* This is BETA release software. As such it may contain software bugs and *
* exhibit inconsistencies. *
* *
* Please send bug reports to polyview@ncsa.uiuc.edu. *
* *
* Copyright (c) 1992 The Board of Trustees of the University of Illinois. *
* *
* Permission to use, copy, and modify this software and its *
* documentation for educational, research, and non-profit purposes is *
* hereby granted, provided that the above copyright notice, the original *
* authors names, and this permission notice appear in all such copies. *
* Any distribution of this software requires the explicit and written *
* authorization of the authors. *
* *
* The University of Illinois makes no representations about the *
* suitability of this software for any purpose. It is provided "as is" *
* without warranty of any kind. *
*****************************************************************************/
/* $Header: /usr3/people/gbourhis/pv3/new/RCS/pvevent.c,v 1.1 92/09/18 10:55:26 marca Exp $ */
#ifdef RCSLOG
$Log: pvevent.c,v $
* Revision 1.1 92/09/18 10:55:26 marca
* Initial revision
*
#endif
#include "pv.h"
#include <gl/device.h>
int init_events(state_t *state)
{
/* Initialize the state variables that the event routines use. */
state->event_count = 0;
state->redraw_count = 0;
return ST_OKAY;
}
int make_window_active (state_t *state, window_t *win)
{
if ((win != state->active_windows) &&
(win != NULL) && (win->type == POLYVIEW))
broadcast_msg(state, win, MSG_NEWACT, state->active_windows);
return ST_OKAY;
}
int process_events (state_t *state)
{
/* Redraw all of the windows that requested it. */
redraw_windows(state);
return 0;
}
int process_next_command (state_t *state)
{
action_t *next;
/* If we've flagged no-actions, then don't do anything,
else grab an action and do it. */
if (!state->no_actions)
{
/* Get the next serial action from the action list. */
/* This function also handles all of the messy details */
/* of removing old actions and updating countdowns for the actions. */
next = next_ser_action(state, state->action_head);
if (next == NULL)
/* No action means that there's nothing to go wrong. */
return ST_OKAY;
else
{
/* Execute the action using do_action. */
return do_action(state, next);
}
}
else
{
return ST_OKAY;
}
}
int animate_windows(state_t *state)
{
window_t *win;
/* Check each window to see if it is worth animating. */
for (win = state->windows; win != NULL; win = win->next)
{
if (((WIN_FORWARD(win) != 0)||(WIN_REVERSE(win) != 0)))
{
/* This window is currently being animated and needs its */
/* animation variables updated. */
(win->countdown)--;
if ((win->countdown <= 0) && (win->animate_fn != NULL))
{
/* The window is to be updated. Call the window's */
/* animate function to handle the details of what */
/* that means for this window type. */
(*win->animate_fn)(state, win);
win->countdown = WIN_DELAY(win);
if (WIN_FORWARD(win) > 0)
WIN_FORWARD(win)--;
else if (WIN_REVERSE(win) > 0)
WIN_REVERSE(win)--;
}
}
}
return ST_OKAY;
}